import request from '@/utils/request'

export default {
  // 添加课程信息
  addCourseInfo(courseInfo) {
    return request({
      url: '/eduservice/course/addCourseInfo',
      method: 'POST',
      data: courseInfo
    })
  },
  // 图片上传接口
  addImage(file) {
    return request({
      url: '/oss/file/upload',
      method: 'POST',
      data: file
    })
  },
  // 根据课程id，查询课程的基本信息
  getCourseInfo(id) {
    return request({
      url: '/eduservice/course/getCourseInfo/' + id,
      method: 'get'
    })
  },

  // 修改课程信息
  updateCourseInfo(courseInfo) {
    return request({
      url: '/eduservice/course/updateCourseInfo',
      method: 'post',
      data: courseInfo
    })
  },

  // 获取课程发布信息
  getPublishCourseInfo(courseId) {
    return request({
      url: '/eduservice/course/getPublishCourseInfo/' + courseId,
      method: 'get'
    })
  },
  // 发布课程信息
  publish(id) {
    return request({
      url: '/eduservice/course/publishCourse/' + id,
      method: 'get'
    })
  },
  // 课程分页查询
  getCourseList(current, limit,query) {
    return request({
      url: '/eduservice/course/pageCourse/' + current + '/' + limit,
      method:"post",
      data:query
    })
  },
  // 删除课程
  deleteCourse(id) {
    return request({
      url: '/eduservice/course/deleteCourse',
      method:"post",
      params: {id}
    })
  }
}
